package cc.kigh.system.remote;

import cc.kigh.common.core.domain.entity.SysDept;
import cc.kigh.system.service.ISysDeptService;
import cn.hutool.core.collection.CollUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author gylang
 * data 2022/3/14
 */
@Service
public class ISysDeptRemoteImpl implements ISysDeptRemote {

    @Autowired
    private ISysDeptService deptService;

    @Override
    public SysDept selectDeptById(long id) {
        return deptService.selectDeptById(id);
    }

    @Override
    public List<SysDept> selectDeptByIds(Collection<Long> deptIds) {
        if (CollUtil.isEmpty(deptIds)) {
            return new ArrayList<>();
        }
        return deptService.lambdaQuery().in(SysDept::getDeptId, deptIds).list();
    }
}
